<div class="mainBox">
	<div class="row">
		<div class="col-lg-12">
			<h1 class="page-header">Danh sách quảng cáo</h1>
		</div>
	</div>
</div><!-- /.mainBox -->

<div id="mainTable">
	<div class="row">
		<div class="col-sm-6">
			<?php
			$start = ($this->Paginator->current($model = null) - 1) * $page_number_limit + 1;
			$end = $start + sizeof($datas) - 1;
			?>
			<div class="dataTables_info" id="dataTables-example_info" role="alert" aria-live="polite" aria-relevant="all">Showing <?php echo $start;?> to <?php echo $end;?> of <?php echo $this->Paginator->param('count');?> entries</div>
		</div>
		<div class="col-sm-6">
			<div id="dataTables-example_paginate" class="dataTables_paginate paging_simple_numbers">
				<ul class="pagination flRight box25">
				<?php
				if($this->Paginator->param('count') > $page_number_limit):
					echo $this->Paginator->prev(__('Previous'), array(
						'class' => 'previous',
						'tag' => 'li',
						'disabledTag' => 'a'
					));

					echo $this->Paginator->numbers(array(
						'separator' => '    ',
						'tag' => 'li',
						'currentClass' => 'active',
						'currentTag' => 'a'
					));

					echo $this->Paginator->next(__('Next'), array(
						'class' => 'next',
						'tag' => 'li',
						'disabledTag' =>'a'
					));
				endif;
				?>
				</ul><!-- /.pagination -->
			</div>
		</div>
	</div>
	<table class="table table-striped table-bordered table-hover" id="dataTables-example">
		<thead>
			<tr>
				<th style="text-align:center">STT</th>
				<th>Thông tin chung</th>
				<th>Ảnh</th>
				<th>Lượt xem</th>
				<th>Active</th>
				<th style="text-align:center"><img alt="Xóa" src="<?php echo $this->webroot ?>img/delete.gif" class="image"></th>
			</tr>
		</thead>
		<tbody>
			<?php if ($this->Paginator->param('count') > 0) :?>
				<?php
				$countno = ($this->Paginator->current($model = null) - 1) * $page_number_limit;
				foreach ($datas as $news):
					$countno++;
				?>
				<tr <?php echo $changeBgTr; ?> >
					<td align="center"><?php echo $countno;?></td>
					<td>
						<table class="child-tbl" border="0" cellpadding="2" cellspacing="1" width="100%">
							<tr>
								<td align="right" class="textBold">Name:</td>
								<td>
									<?php
									echo $this->Form->input('ban_name', array(
											'type' => 'text',
											'label' => false,
											'class' => 'form-control',
											'required' => true,
											'value'=> $news['Advertise']['ban_name'],
									));
									?>
								</td>
							</tr>
							<tr>
								<td align="right" class="textBold">Url:</td>
								<td>
									<?php
									echo $this->Form->input('ban_link', array(
											'type' => 'text',
											'label' => false,
											'class' => 'form-control w400',
											'required' => true,
											'value'=> $news['Advertise']['ban_link'],
									));
									?>
								</td>
							</tr>
							<tr>
								<td align="right" nowrap class="textBold">Target:</td>
								<td>
									<?php
									echo $this->Form->input('ban_target', array(
											'options' => $target,
											'label' => false,
											'div' => false,
											'class' => 'form-control',
											'value'=> $news['Advertise']['ban_target'],
									));
									?>
								</td>
							</tr>

							<tr>
								<td nowrap="nowrap" align="right" class="textBold">Position:</td>
								<td>
									<?php
									echo $this->Form->input('ban_type', array(
											'options' => $banner_type,
											'empty' => '--Choose banner type--',
											'label' => false,
											'class' => 'form-control',
											'value'=> $news['Advertise']['ban_type'],
									));
									?>
								</td>
							</tr>
							<tr>
								<td nowrap="nowrap" align="right" class="textBold">Order:</td>
								<td>
									<?php
									echo $this->Form->input('ban_order', array(
											'type' => 'text',
											'label' => false,
											'class' => 'form-control',
											'required' => true,
											'value'=> $news['Advertise']['ban_order'],
									));
									?>
								</td>
							</tr>
						</table>
					</td>
					<td>
						<div class="advertise"><?php echo $this->Html->image('/picture_banners/'.$news['Advertise']['ban_picture'], array('alt' => '', 'fullBase' => false));?></div>
					</td>
					<td align="center">
						<?php echo $news['Advertise']['ban_hits'];?>
					</td>
					<td align="center">
						<?php
						$checked = 0;
						if ($news['Advertise']['ban_active'] == 1) {
							$checked = 1;
						}
						?>
						<a class="news_update_hot" href="<?php echo $this->Html->url(array('controller' => 'advertise', 'action' => 'update', $news['Advertise']['id'], 'ban_active')) ?>" title="Active or Inactive" rel="tooltip">
							<?php echo $this->Html->image("check_$checked.gif", array("alt" => "", 'class' => 'image_hot', 'value' => abs($news['Advertise']['ban_active'] - 1)));?>
						</a>
					</td>
					<td align="center">
						<?php
						echo $this->Form->postLink(
							'Delete',
							array('controller' => 'news', 'action' => 'delete', $news['Advertise']['id']), null, __('Are you sure you want to delete ?', $news['Advertise']['id'])
						);
						?>
					</td>

				</tr>
				<?php endforeach;//end foreach $datas?>
			<?php endif;//end if count($datas)?>
		</tbody>
	</table>
	<div class="row">
		<div class="col-sm-6">
			<div class="dataTables_info" id="dataTables-example_info" role="alert" aria-live="polite" aria-relevant="all">Showing <?php echo $start;?> to <?php echo $end;?> of <?php echo $this->Paginator->param('count');?> entries</div>
		</div>
		<div class="col-sm-6">
			<div id="dataTables-example_paginate" class="dataTables_paginate paging_simple_numbers">
				<ul class="pagination flRight box25">
				<?php
				if($this->Paginator->param('count') > $page_number_limit):
					echo $this->Paginator->prev(__('previous'), array(
						'class' => 'previous',
						'tag' => 'li',
						'disabledTag' => 'a'
					));

					echo $this->Paginator->numbers(array(
						'separator' => '    ',
						'tag' => 'li',
						'currentClass' => 'active',
						'currentTag' => 'a'
					));

					echo $this->Paginator->next(__('next'), array(
						'class' => 'next',
						'tag' => 'li',
						'disabledTag' =>'a'
					));
				endif;
				?>
				</ul><!-- /.pagination -->
			</div>
		</div>
	</div>


</div>
<script type="text/javascript">
function checkAll(){

	if ($('#check-all').attr('checked') == true) {
		$('.item-element').attr('checked', true);
	} else {
		$('.item-element').attr('checked', false);
	}
}
</script>